package shayu.order.controller;

import io.swagger.models.auth.In;
import org.springframework.amqp.core.AmqpAdmin;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import shayu.order.entity.OrderEntity;
import shayu.order.entity.OrderReturnReasonEntity;

import java.util.Date;

@RestController
public class RabbitController {

    @Autowired
    private RabbitTemplate rabbitTemplate;

    @GetMapping("/sendMq")
    public String sendMq(@RequestParam(value = "num",defaultValue = "10")Integer num){
        for (int i=0;i<num;i++){
            if(i%2==0){
                OrderReturnReasonEntity reasonEntity = new OrderReturnReasonEntity();
                reasonEntity.setId(1L);
                reasonEntity.setCreateTime(new Date());
                reasonEntity.setName("鲨鱼"+i);
            }else{
                OrderEntity orderEntity = new OrderEntity();
                orderEntity.setId(1l);

            }
        }
        return "String";
    }
}
